home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
dev
/
c
/
EGCSWOSAlib.lha
/
src.lha
/
CreatePort.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-01-04
|
1KB
|
61 lines
/*
** amiga.lib for vbcc-PowerOpen/WarpOS
**
** CreatePort(), DeletePort()
**
** V0.2 19-Apr-98 phx
** replaced <clib/powerpc/powerpc_protos.h> by <clib/powerpc_protos.h>
** AllocVecPPC() returns APTR, so a cast is needed
** V0.1 15-Mar-98 phx
** created
*/
#include <exec/ports.h>
#include <exec/memory.h>
#include <clib/alib_protos.h>
#include <proto/exec.h>
#include <powerpc/powerpc_protos.h>
struct MsgPort *CreatePort(STRPTR name,LONG pri)
{
struct MsgPort *port;
UBYTE portsig;
if ((BYTE)(portsig=AllocSignal(-1)) < 0)
return NULL;
if (!(port = (struct MsgPort *)
AllocVecPPC(sizeof(struct MsgPort),MEMF_CLEAR|MEMF_PUBLIC,0)))
FreeSignal(portsig);
else
{
port->mp_Node.ln_Type=NT_MSGPORT;
port->mp_Node.ln_Pri=pri;
port->mp_Node.ln_Name=name;
/* done via AllocMem
port->mp_Flags=PA_SIGNAL;
*/
port->mp_SigBit=portsig;
port->mp_SigTask=FindTask(NULL);
if (port->mp_Node.ln_Name)
AddPort(port);
else
NewList(&port->mp_MsgList);
}
return port;
}
void DeletePort(struct MsgPort *port)
{
int i;
if (port->mp_Node.ln_Name != NULL)
RemPort(port);
i=-1;
port->mp_Node.ln_Type=i;
port->mp_MsgList.lh_Head=(struct Node *)i;
FreeSignal(port->mp_SigBit);
FreeVecPPC((APTR)port);
}